package Offer.offer2016;
//��Ч�ʷ����n������
public class Test34 
{

	public static void main(String[] args) 
	{
		System.out.println(findUglyAtN(100));

	}
    public static int findUglyAtN(int n)
    {
    	if(n<1)
    		return 0;
    	int count=0;
    	int m =0;
    	while(count<n)
    	{
    		m++;
    		if(isUgly(m))
    		{
    			count++;
    		}
    	}
    	return m;
    }
    public static boolean isUgly(int m)
    {
    	while(m%2==0)
    		m=m/2;
    	while(m%3==0)
    		m=m/3;
    	while(m%5==0)
    		m=m/5;
    	if(m==1)
    		return true;
    	else
    		return false;
    }
}
